package com.sy.cloud.wechat.entity.message;

import com.alibaba.fastjson.JSON;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by zhuwenquan on 2017-10-30.
 */

@Getter
@Setter
public class TemplateMessage {
    private String touser;
    private String template_id;
    private String url;
    private String topcolor;
    private Map<String, Pair> data = new HashMap();

    public void addKeyValue(final String key, final String value, final String color) {
        data.put(key, new Pair(value, color));
    }

    @Getter
    @Setter
    @AllArgsConstructor
    public static class Pair {
        private String value;
        private String color;
    }

    public String toJSON() {
        return JSON.toJSONString(this);
    }

    public Pair getParamValue(final String key) {
        return data.get(key);
    }
}
